\(\int \sin ^m(e+f x) (1+m-(2+m) \sin ^2(e+f x)) \, dx\) [1]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F(-1)]
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 25, antiderivative size = 20 \[ \int \sin ^m(e+f x) \left (1+m-(2+m) \sin ^2(e+f x)\right ) \, dx=\frac {\cos (e+f x) \sin ^{1+m}(e+f x)}{f} \]

[Out]

cos(f*x+e)*sin(f*x+e)^(1+m)/f

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 20, normalized size of antiderivative = 1.00, number of steps used = 1, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.040, Rules used = {3090} \[ \int \sin ^m(e+f x) \left (1+m-(2+m) \sin ^2(e+f x)\right ) \, dx=\frac {\cos (e+f x) \sin ^{m+1}(e+f x)}{f} \]

[In]

Int[Sin[e + f*x]^m*(1 + m - (2 + m)*Sin[e + f*x]^2),x]

[Out]

(Cos[e + f*x]*Sin[e + f*x]^(1 + m))/f

Rule 3090

Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_) + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[A*Cos[e
+ f*x]*((b*Sin[e + f*x])^(m + 1)/(b*f*(m + 1))), x] /; FreeQ[{b, e, f, A, C, m}, x] && EqQ[A*(m + 2) + C*(m +
1), 0]

Rubi steps \begin{align*} \text {integral}& = \frac {\cos (e+f x) \sin ^{1+m}(e+f x)}{f} \\ \end{align*}

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.

Time = 0.13 (sec) , antiderivative size = 107, normalized size of antiderivative = 5.35 \[ \int \sin ^m(e+f x) \left (1+m-(2+m) \sin ^2(e+f x)\right ) \, dx=\frac {\sqrt {\cos ^2(e+f x)} \sec (e+f x) \sin ^{1+m}(e+f x) \left ((3+m) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1+m}{2},\frac {3+m}{2},\sin ^2(e+f x)\right )-(2+m) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {3+m}{2},\frac {5+m}{2},\sin ^2(e+f x)\right ) \sin ^2(e+f x)\right )}{f (3+m)} \]

[In]

Integrate[Sin[e + f*x]^m*(1 + m - (2 + m)*Sin[e + f*x]^2),x]

[Out]

(Sqrt[Cos[e + f*x]^2]*Sec[e + f*x]*Sin[e + f*x]^(1 + m)*((3 + m)*Hypergeometric2F1[1/2, (1 + m)/2, (3 + m)/2,
Sin[e + f*x]^2] - (2 + m)*Hypergeometric2F1[1/2, (3 + m)/2, (5 + m)/2, Sin[e + f*x]^2]*Sin[e + f*x]^2))/(f*(3
+ m))

Maple [A] (verified)

Time = 3.06 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.15

method result size
parallelrisch \(\frac {\left (\sin ^{m}\left (f x +e \right )\right ) \sin \left (2 f x +2 e \right )}{2 f}\) \(23\)

[In]

int(sin(f*x+e)^m*(1+m-(2+m)*sin(f*x+e)^2),x,method=_RETURNVERBOSE)

[Out]

1/2/f*sin(f*x+e)^m*sin(2*f*x+2*e)

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.20 \[ \int \sin ^m(e+f x) \left (1+m-(2+m) \sin ^2(e+f x)\right ) \, dx=\frac {\sin \left (f x + e\right )^{m} \cos \left (f x + e\right ) \sin \left (f x + e\right )}{f} \]

[In]

integrate(sin(f*x+e)^m*(1+m-(2+m)*sin(f*x+e)^2),x, algorithm="fricas")

[Out]

sin(f*x + e)^m*cos(f*x + e)*sin(f*x + e)/f

Sympy [F(-1)]

Timed out. \[ \int \sin ^m(e+f x) \left (1+m-(2+m) \sin ^2(e+f x)\right ) \, dx=\text {Timed out} \]

[In]

integrate(sin(f*x+e)**m*(1+m-(2+m)*sin(f*x+e)**2),x)

[Out]

Timed out

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 248 vs. \(2 (20) = 40\).

Time = 0.56 (sec) , antiderivative size = 248, normalized size of antiderivative = 12.40 \[ \int \sin ^m(e+f x) \left (1+m-(2+m) \sin ^2(e+f x)\right ) \, dx=-\frac {{\left (\left (-1\right )^{\frac {1}{2} \, m} e^{\left (\frac {1}{2} \, m \log \left (\cos \left (f x + e\right )^{2} + \sin \left (f x + e\right )^{2} + 2 \, \cos \left (f x + e\right ) + 1\right ) + \frac {1}{2} \, m \log \left (\cos \left (f x + e\right )^{2} + \sin \left (f x + e\right )^{2} - 2 \, \cos \left (f x + e\right ) + 1\right )\right )} \sin \left (-{\left (f x + e\right )} {\left (m + 2\right )} + m \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right ) + 1\right ) - m \arctan \left (\sin \left (f x + e\right ), -\cos \left (f x + e\right ) + 1\right )\right ) - \left (-1\right )^{\frac {1}{2} \, m} e^{\left (\frac {1}{2} \, m \log \left (\cos \left (f x + e\right )^{2} + \sin \left (f x + e\right )^{2} + 2 \, \cos \left (f x + e\right ) + 1\right ) + \frac {1}{2} \, m \log \left (\cos \left (f x + e\right )^{2} + \sin \left (f x + e\right )^{2} - 2 \, \cos \left (f x + e\right ) + 1\right )\right )} \sin \left (-{\left (f x + e\right )} {\left (m - 2\right )} + m \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right ) + 1\right ) - m \arctan \left (\sin \left (f x + e\right ), -\cos \left (f x + e\right ) + 1\right )\right )\right )} 2^{-m - 2}}{f} \]

[In]

integrate(sin(f*x+e)^m*(1+m-(2+m)*sin(f*x+e)^2),x, algorithm="maxima")

[Out]

-((-1)^(1/2*m)*e^(1/2*m*log(cos(f*x + e)^2 + sin(f*x + e)^2 + 2*cos(f*x + e) + 1) + 1/2*m*log(cos(f*x + e)^2 +
 sin(f*x + e)^2 - 2*cos(f*x + e) + 1))*sin(-(f*x + e)*(m + 2) + m*arctan2(sin(f*x + e), cos(f*x + e) + 1) - m*
arctan2(sin(f*x + e), -cos(f*x + e) + 1)) - (-1)^(1/2*m)*e^(1/2*m*log(cos(f*x + e)^2 + sin(f*x + e)^2 + 2*cos(
f*x + e) + 1) + 1/2*m*log(cos(f*x + e)^2 + sin(f*x + e)^2 - 2*cos(f*x + e) + 1))*sin(-(f*x + e)*(m - 2) + m*ar
ctan2(sin(f*x + e), cos(f*x + e) + 1) - m*arctan2(sin(f*x + e), -cos(f*x + e) + 1)))*2^(-m - 2)/f

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 425 vs. \(2 (20) = 40\).

Time = 3.54 (sec) , antiderivative size = 425, normalized size of antiderivative = 21.25 \[ \int \sin ^m(e+f x) \left (1+m-(2+m) \sin ^2(e+f x)\right ) \, dx=\frac {2 \, {\left (\left (\frac {2 \, {\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) \right |}}{\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 1}\right )^{m} \tan \left (\pi m \left \lfloor -\frac {1}{4} \, \mathrm {sgn}\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right ) + \frac {3}{4} \right \rfloor + \frac {1}{4} \, \pi m \mathrm {sgn}\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right ) - \frac {1}{4} \, \pi m\right )^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - \left (\frac {2 \, {\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) \right |}}{\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 1}\right )^{m} \tan \left (\pi m \left \lfloor -\frac {1}{4} \, \mathrm {sgn}\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right ) + \frac {3}{4} \right \rfloor + \frac {1}{4} \, \pi m \mathrm {sgn}\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right ) - \frac {1}{4} \, \pi m\right )^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - \left (\frac {2 \, {\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) \right |}}{\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 1}\right )^{m} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + \left (\frac {2 \, {\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) \right |}}{\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 1}\right )^{m} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )}}{f \tan \left (\pi m \left \lfloor -\frac {1}{4} \, \mathrm {sgn}\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right ) + \frac {3}{4} \right \rfloor + \frac {1}{4} \, \pi m \mathrm {sgn}\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right ) - \frac {1}{4} \, \pi m\right )^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{4} + 2 \, f \tan \left (\pi m \left \lfloor -\frac {1}{4} \, \mathrm {sgn}\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right ) + \frac {3}{4} \right \rfloor + \frac {1}{4} \, \pi m \mathrm {sgn}\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right ) - \frac {1}{4} \, \pi m\right )^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + f \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{4} + f \tan \left (\pi m \left \lfloor -\frac {1}{4} \, \mathrm {sgn}\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right ) + \frac {3}{4} \right \rfloor + \frac {1}{4} \, \pi m \mathrm {sgn}\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right ) - \frac {1}{4} \, \pi m\right )^{2} + 2 \, f \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + f} \]

[In]

integrate(sin(f*x+e)^m*(1+m-(2+m)*sin(f*x+e)^2),x, algorithm="giac")

[Out]

2*((2*abs(tan(1/2*f*x + 1/2*e))/(tan(1/2*f*x + 1/2*e)^2 + 1))^m*tan(pi*m*floor(-1/4*sgn(tan(1/2*f*x + 1/2*e))
+ 3/4) + 1/4*pi*m*sgn(tan(1/2*f*x + 1/2*e)) - 1/4*pi*m)^2*tan(1/2*f*x + 1/2*e)^3 - (2*abs(tan(1/2*f*x + 1/2*e)
)/(tan(1/2*f*x + 1/2*e)^2 + 1))^m*tan(pi*m*floor(-1/4*sgn(tan(1/2*f*x + 1/2*e)) + 3/4) + 1/4*pi*m*sgn(tan(1/2*
f*x + 1/2*e)) - 1/4*pi*m)^2*tan(1/2*f*x + 1/2*e) - (2*abs(tan(1/2*f*x + 1/2*e))/(tan(1/2*f*x + 1/2*e)^2 + 1))^
m*tan(1/2*f*x + 1/2*e)^3 + (2*abs(tan(1/2*f*x + 1/2*e))/(tan(1/2*f*x + 1/2*e)^2 + 1))^m*tan(1/2*f*x + 1/2*e))/
(f*tan(pi*m*floor(-1/4*sgn(tan(1/2*f*x + 1/2*e)) + 3/4) + 1/4*pi*m*sgn(tan(1/2*f*x + 1/2*e)) - 1/4*pi*m)^2*tan
(1/2*f*x + 1/2*e)^4 + 2*f*tan(pi*m*floor(-1/4*sgn(tan(1/2*f*x + 1/2*e)) + 3/4) + 1/4*pi*m*sgn(tan(1/2*f*x + 1/
2*e)) - 1/4*pi*m)^2*tan(1/2*f*x + 1/2*e)^2 + f*tan(1/2*f*x + 1/2*e)^4 + f*tan(pi*m*floor(-1/4*sgn(tan(1/2*f*x
+ 1/2*e)) + 3/4) + 1/4*pi*m*sgn(tan(1/2*f*x + 1/2*e)) - 1/4*pi*m)^2 + 2*f*tan(1/2*f*x + 1/2*e)^2 + f)

Mupad [B] (verification not implemented)

Time = 12.94 (sec) , antiderivative size = 22, normalized size of antiderivative = 1.10 \[ \int \sin ^m(e+f x) \left (1+m-(2+m) \sin ^2(e+f x)\right ) \, dx=\frac {{\sin \left (e+f\,x\right )}^m\,\sin \left (2\,e+2\,f\,x\right )}{2\,f} \]

[In]

int(sin(e + f*x)^m*(m - sin(e + f*x)^2*(m + 2) + 1),x)

[Out]

(sin(e + f*x)^m*sin(2*e + 2*f*x))/(2*f)